import { Injectable } from '@angular/core';
import { Subject } from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class CoreMessageService {
  private modeSearchMessageSource = new Subject<string>();
  nodemessage = this.modeSearchMessageSource.asObservable();
  messageAction(nodeinfo: any) {
    this.modeSearchMessageSource.next(nodeinfo);
  }

  // 显示并传值给modal框
  private modalShow = new Subject<any>();
  showmodal = this.modalShow.asObservable();
  showModal(data) {
    this.modalShow.next(data);
  }

  // 传值告诉绘制图层清空绘制
  private drawclear = new Subject<boolean>();
  cleardraw = this.drawclear.asObservable();
  clearAll() {
    this.drawclear.next(true);
  }

  // 打开【管线统计】模块的统计面板
  private showStatic = new Subject<any>();
  showstaticresult = this.showStatic.asObservable();
  showStaticResult(data) {
    this.showStatic.next(data);
  }

  // 传递【管线统计】模块当前选择的是管点类型还是管线类型
  private selectRedioValue = new Subject<any>();
  selectredio = this.selectRedioValue.asObservable();
  currentRedio(data) {
    this.selectRedioValue.next(data);
  }

  // 传递快捷操作指标卡所选item的状态
  private itemStatus = new Subject<any>();
  currentLayerStatus = this.itemStatus.asObservable();
  sendLayerStatus(data) {
    this.itemStatus.next(data);
  }

  constructor() { }

}
